home *** CD-ROM | disk | FTP | other *** search
- Path: saluki-news.wham.siu.edu!usenet
- From: Samer Kanjo <scamer@siu.edu>
- Newsgroups: comp.lang.c++
- Subject: Class libraries
- Date: Sat, 20 Apr 1996 18:00:27 -0500
- Organization: Southern Illinois University - Carbondale
- Message-ID: <31796C8B.583A@siu.edu>
- NNTP-Posting-Host: rm320217.cag.siu.edu
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.01 (Win95; I)
-
- I was having trouble with the array class iterator. Here is the code:
-
- typedef TDArrayAsVector<TInt> arrayType;
- typedef TDArrayAsVectorIterator<TInt> iteratorType;
-
- const int cSize = 100;
-
- struct COLORDER
- {
- arrayType *ident;
- arrayType *compl;
- };
-
- struct COLORDER colOrder[cSize];
- for(int col = 0; col < cSize; col++)
- {
- colOrder[col].ident = new arrayType(0,0,1);
- colOrder[col].compl = new arrayType(0,0,1);
- }
- .
- .
- .
- Some items are added to some of the arrays ident and compl.
- .
- .
- .
- for(int col = 0; col < cSize; col++)
- {
- for(iteratorType identIter(*(colOrder[col].ident)); identIter; identIter++)
- cout << identIter.Current() << endl;
- for(iteratorType complIter(*(colOrder[col].compl)); complIter; complIter++)
- cout << complIter.Current() << endl;
- }
-
- The last for loop was executed by a function call made from a window's Paint
- member function. Basically I need to display the contents of the two arrays
- on the screen in a window with scrollbars. The above code is not the exact
- way I display the data--the for loops are the same but the couts are not.
- Whenever the screen is resized or the scrollbars are moved the window is
- invalidated.
-
- Sometimes it displays fine and I am able to use the scrollbars to look at
- all of the data. The problem is an error in the vectimp.h file. It is always
- the same line in the file that causes the error. I unfortunately don't have
- the line number with me now but I can provide it if can help.
-
- Is the cause of this error the result of the code in my last for loop or
- is it a bug in the array template class?
-
- I would appreciate any help.
-
- Samer Kanjo
- scamer@siu.edu
-